package com.eaoa.uc.busvehicle.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.constants.AttachmentConstants;
import com.eaoa.query.bus.BusVehicleQuery;
import com.eaoa.utils.AttachmentUtils;
import com.eaoa.vo.bus.BusVehicle;
import com.stony.core.util.CoreUtils;

public class BusVehicleManageSearchExpandAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		Long vehicleno = CoreUtils.parseLong(request.getParameter("vehicleno"));

		BusVehicle customer = BusVehicleQuery.loadByNO(vehicleno);

		request.setAttribute("result", customer);

		if (vehicleno != null) {
			Map attachments = AttachmentUtils.getAttachmentMap(
					AttachmentConstants.ATTACHMENTTYPE_VEHICLE, vehicleno);
			request.setAttribute("attachments", attachments);
		}

		return mapping.findForward("success");
	}
}
